<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateApplicationsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('applications', function (Blueprint $table) {
            $table->increments('id')->comment('表备注：应用信息表');
            $table->string('name')->unique()->comment('应用名称');
            $table->string('app_id')->unique()->comment('应用ID');
            $table->string('secret_key')->comment('api秘钥,第三方调用使用秘钥');
    
            $table->tinyInteger('status')->default(1)->comment('状态,1:允许访问，0:禁止访问');
            $table->tinyInteger('ip_limit_switch')->default(0)->comment('ip限制,1:开启ip限制，0：关闭ip限制');
            $table->string('ip_limit_list',600)->default('')->comment("允许的ip白名单列表，ip之间英文','相隔");
    
            $table->string('desc')->default('')->comment('备注');
            $table->dateTime('created_at')->nullable();
            $table->dateTime('updated_at')->nullable();
            $table->tinyInteger('deleted')->default(0)->comment('是否删除,1:是,0:否');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('applications');
    }
}
